package com.spider.demo1;

import java.util.HashSet;
import java.util.Set;

public class SetDemo2 {
    public static void main(String[] args) {
        //HashSet集合元素的去重操作
        Student s1 = new Student("小王", 18, "男");
        Student s2 = new Student("小王", 18, "男");
        Student s3 = new Student("小昭", 18, "女");
        Student s4 = new Student("小孙", 20, "女");

        Set<Student> set = new HashSet<>();
        set.add(s1);
        set.add(s2);
        set.add(s3);
        set.add(s4);
        System.out.println(set);
    }
}
